/**
 * 测试5：一次性给服务器发送多条请求，每条请求都应该正确处理
 */

 #include "../source/server.hpp"

int main()
{
    Socket socket;
    socket.CreateClient(8080, "127.0.0.1");
    std::string str = "GET /hello HTTP/1.1\r\nConnection: keep-alive\r\nContent-Length: 0\r\n\r\n";
    str += "GET /hello HTTP/1.1\r\nConnection: keep-alive\r\nContent-Length: 0\r\n\r\n";
    str += "GET / HTTP/1.1\r\nConnection: keep-alive\r\nContent-Length: 0\r\n\r\n";
    while (1)
    {
        assert(socket.Send(str.c_str(), str.size()) != -1);
        char buffer[1024] = {0};
        socket.Recv(buffer, sizeof(buffer) - 1);
        std::cout << buffer << std::endl;
        sleep(13);
    }
    socket.Close();
    return 0;
}